﻿using System;

public enum ReplyState{
	Normal,
	Hidden,
}
public class Reply
{
	//从数据库中创建
	public Reply(String author,Int32 topicID,Int32 replyID,
		String title, String content, String createTime, ReplyState state)
	{
		_author = author;
		_topicID = topicID;
		_replyID = replyID;
		_title = title;
		_content = content;
		_createTime = createTime;
		_state=state;
	}
	//用户添加回复
	public Reply(String author, Int32 topicID, 
		String title, String content)
	{
		_author = author;
		_topicID = topicID;
		_title = title;
		_content = content;
		_replyID = 1;//第一楼
		_createTime = DateTime.Now.ToString();
		_state = ReplyState.Normal;
	}
	//以XHTML标签格式化Topic各项内容
	public String Render(Boolean isOdd)
	{
		// 					if (reply.isJingPin())
// 						out.print("[<span class=\"Red\">精品</span>]");
// 					if (reply.isVoting())
// 						out.print("[<span class=\"Green\">投票</span>]");
// 					if (reply.isTop())
// 						out.print("[<span class=\"Green\">置顶</span>]");

		return "<div class='rpl'>"+
						"<div class='topicTitle'>"+_replyID+"、"+_title+"</div>"+
						"<div class='replyBody'>"+
							"<div class='text'>"+_content+"</div>"+
							"<div class='signature'>"+
								"作者：<span class='author'>" 
								+ SE6.UserMan.GetUserProfileURL(_author) + "</span>" +
								"<span class='time'>"+_createTime+"</span>"+
								"<a class='button' href='#' onclick=\"document.forms[0].title.value='回复："+_replyID+"楼';return false;\">回复此发言</a>"+
								"</div>"+
								"<div class='replyLine'></div>" +
						"</div>"+
					"</div>";
	}

	//当前主题
	public Int32 TopicID
	{
		get{return _topicID;}
	}
	//回复编号
	public Int32 ReplyID
	{
		get{return _replyID;}
		set{_replyID=value;}
	}
	//回复标题
	public String Title
	{
		get{return _title;}
	}
	//回复内容
	public String Content
	{
		get {return _content;}
	}
	//回复发表时间
	public String CreateTime
	{
		get{return _createTime;}
	}
	//回复者
	public String Author{
		get { return _author; }
	}
	//回复状态
	public ReplyState State
	{
		get { return _state; }
	}
	private String _author;//回复者
	private Int32 _topicID;//当前主题
	private Int32 _replyID;//回复编号
	private String _title;//回复标题
	private String _content;//回复内容
	private String _createTime;//回复发表时间
	private ReplyState _state;//回复状态
}
